﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace R10App
{
    class FilterMA
    {
        private Queue<double> Data = new Queue<double>();

        public void Init(int size, int defval)
        {
            for (int i = 0; i != size; i++)
            {
                Data.Enqueue(defval);
            }
        }

        public double AddPoint(double point)
        {
            Data.Dequeue();
            Data.Enqueue(point);

            double avg = Data.Average();

            return avg;
        }
    }
}
